package com.example.service.impl;

import com.example.mapper.OperateLogMapper;
import com.example.pojo.EmpQueryParam;
import com.example.pojo.OperateLog;
import com.example.pojo.PageResult;
import com.example.service.OperateLogService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * operateLogServiceImpl 类的描述信息
 *
 * @author 12427
 * @since 2025/6/9 14:40
 */
@Service
public class OperateLogServiceImpl implements OperateLogService {
    @Autowired
    private OperateLogMapper operateLogMapper;

    @Override
    public PageResult<OperateLog> selectLog(EmpQueryParam empQueryParam) {
//        设置分页数
        PageHelper.startPage(empQueryParam.getPage(), empQueryParam.getPageSize());
//        执行查询
        List<OperateLog> list = operateLogMapper.slectLog(empQueryParam);
//        结果封装
        Page<OperateLog> p = (Page<OperateLog>) list;
        return new PageResult<OperateLog>(p.getTotal() , p.getResult());
    }
}
